#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>


int main(int argc, char *argv[])
{
    int len;
	char read_buf[1024];

    if(argc < 2){
        printf("please input  at least 2 args\n");
        printf("%s <dev> [string]\n", argv[0]);
        return -1;
    }

    /*open*/
    int fd;
    fd = open(argv[1], O_RDWR);
    if(fd < 0){
        printf("open failed\n");
        return -2;
    }

	printf("pid = %d\n", getpid());

	read(fd, read_buf, 1024);
	printf("read data = \"%s\"\n", read_buf);

	sleep(5);
    
    close(fd);

	printf("\nhello app ending !!!\n");

    return 0;
}

